{* $Id$ *}
{include_core file="admin/lib/header.html" title="快递展示"}
<div class="page-header border-bottom clearfix">
  <h2 class="left">快递管理<span>{if $express_info}编辑{else}添加{/if}快递</span></h2>
  <a href="{AnUrl('express/admin')}" class="btn btn-default btn-sm right">&lt;&nbsp;返回快递列表</a>
</div>
<!--start:快递新增-->
<div class="add-form">
  <form class="js_creatForm" action="{AnUrl('express/admin/save')}" method="post" enctype="multipart/form-data">
    <input type="hidden" name="express_id" value="{$express_info.id}">
    <table class="table" cellpadding="0" cellspacing="0">      
    <input type="hidden" name="info[express_code]" class="js_expressCode" value="{$express_info.express_code}">
      <tr>
        <th><label for="" class="add-f-label">快递名称：</label></th>
        <td>
        {$express_list = express_config::$express_list}
          <select class="add-f-slt1 js_title" name="info[title]">
            <option value="" selected>请选择快递公司</option>
            {foreach $express_list as $k=>$v}
              <option value="{$v.name}" {if $express_info.title == $v.name} selected {/if} data-code="{$v.code}">{$v.name}</option>
            {/foreach}
          </select>
          <div class="tips"><span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>选择并设置快递公司</div>
        </td>
      </tr>
      <tr>
        <th><label for="" class="add-f-label">快递简介：</label></th>
        <td>
          <input name="info[intro]" style="width:490px;" value="{$express_info.intro}" type="text" class="add-f-ipt1 js_intro">
        </td>
      </tr>
      <tr>
        <th><label for="" class="add-f-label">排序：</label></th>
        <td>
          <input name="info[view_order]" value="0" type="text" class="add-f-ipt1">
        </td>
      </tr>
      <tr><th>&nbsp;</th><td class="noborder"><button type="submit" class="btn btn-success js_submit">&nbsp;&nbsp;&nbsp;确认&nbsp;&nbsp;&nbsp;</button></td></tr>
    </table>
  </form>
</div>
<!--end:快递新增-->
<script>
$(function(){
  $('.js_title').on('change', function(){
    var name = $(this).val();
    var code = $(this).find('option[value='+name+']').data('code');
    $('.js_expressCode').val(code);
  });

  // 提交验证
  $('.js_submit').click(function(e){
    e.preventDefault();
    var title      = $.trim($('.js_title').val());
    if (!title) {
      showMsg('请选择快递公司');
      return;
    }

    $('.js_creatForm').submit();
  });
});
</script>
{include_core file="admin/lib/footer.html"}